package com.aischool.service;

import java.util.List;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;

public class SysAppService {
	
	public final String CK_CacheName = "CacheApp";
	public final String CK_Sys_App_All = "CK_Sys_App_All";
	
	/**
	 * 获取全部数据
	 * @return
	 */
	public List<Record> getSysAppAll(){
		return Db.findByCache(CK_CacheName, CK_Sys_App_All, "SELECT * FROM sys_app WHERE app_state=1 ORDER BY app_id");
	}
	
	public Record getSysApp(int app_id) {
		List<Record> listapp = getSysAppAll();
		for(int i=0;i<listapp.size();i++) {
			if (listapp.get(i).getInt("app_id") == app_id) {
				return listapp.get(i);
			}
		}
		return null;
	}
}
